{extend name="ashippingguide/Public/base" /}
{block name="container"}

<div class="page-heade">
    <h2 class="title_color text-center">添加导购目标格式</h2>
</div>
<form action="" class="form-inline" id="form1" method="post">
    <table class="table table-bordered">
        <tr>
            <td colspan="2">
                <button class="btn btn-sm btn-primary addguidesall">添加导购目标格式</button>
            </td>
        </tr>
        <tr>
            <td><label for="cainian">财年：</label></td>
            <td><input type="text" class="form-control inputremindPeple" id="cainian" name="a.year" value="<?php if(isset($where['a_year'])) echo $where['a_year']; ?>"></td>
        </tr>
        <tr>
            <td colspan="2" style="text-align: center;">
                <button class="btn btn-info" type="submit">查询</button>
                <button class="btn btn-info emtyif" id="reset" type="reset">清空查询条件</button>
            </td>
        </tr>
    </table>
<table class="table table-striped table-bordered table-hover bud_hei text-center aprovalSystemTable" style="width: 100%;">
    <tr class="info">
        <th class="text-center">No.</th>
        <th class="text-center">财年</th>
        <th class="text-center">创建人</th>
        <th class="text-center">创建时间</th>
        <th class="text-center">操作</th>
    </tr>
    <tbody>
    {volist name="data" id="list"}
    <tr>
        <td>{$i}</td>
        <td>{$list.year}</td>
        <td>{$list.createUser}</td>
        <td>{$list.createDate}</td>
        <td>
            <a href="javascript:;" class="modify" onclick="edit({$list.id})">修改</a>
        </td>
    </tr>
    {/volist}
    </tbody>
</table>
<h5 class="text-center" style="font-size: 13px;font-weight: 500">
    总共有{$count}条记录，第{$page}/{$maxpage}页,当前页<input id="page" name="pages" type="text" style="width: 40px" value="1"/>
    <button id="gopage">Go</button>&nbsp;&nbsp;<button
        id="fistpage" onclick="$('#form1').find('input').val('');">首页</button>&nbsp;&nbsp;
    每页显示
    <select id="pagesize" name="limts">
        <option value='10' selected>10条</option>
        <option value='15'>15条</option>
        <option value='20'>20条</option>
    </select>
    <script>
        $('#pagesize').val("{$limit}");
    </script>
</h5>
</form>
<script>
    function edit(id){
            layer.open({
                type: 2,
                title: '修改导购目标格式',
                maxmin: true, //开启最大化最小化按钮
                area: ['900px', '450px'],
                content: "{:url('editformat')}?id="+id
            })
            return false
    }
    $(document).ready(function () {
        $(".addguidesall").click(function () {
            layer.open({
                type: 2,
                title: '添加导购目标格式',
                maxmin: true, //开启最大化最小化按钮
                area: ['900px', '450px'],
                content: "{:url('addformat')}"
            })
            return false
        });

        $('#reset').on('click',function () {
            $("#form1 input").each(function(){
                $(this).val('');
            });
            $("#form1 select").each(function(){
                $(this).val('');
            });
            $('#form1').submit()
            return false
        })
        //删除
        $('.shanchu').click(function () {
            var link = $(this).attr('href')
            swal({
                title: "您确定要删除这条信息吗",
                text: "删除后将无法恢复，请谨慎操作！",
                type: "warning",
                showCancelButton: true,
                confirmButtonColor: "#DD6B55",
                confirmButtonText: "删除",
                closeOnConfirm: false
            }, function (isConfirm) {
                if(isConfirm){
                    $.ajax({
                        'type':'post',
                        'url':link,
                        'dataType':'json',
                        'success':function (data) {
                            if(data.success){
                                location.reload()
                            }else
                                swal(data.msg, "", "error");
                        }
                    })
                }

            });
            return false
        });
    })
</script>

{/block}